package com.auto.api.http.service;

import com.auto.api.core.entity.ApplicationInfo;
import com.auto.api.core.service.ApplicationInfoService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * @program:
 * @description:
 * @author: liangshf
 * @create: 2022-01-07
 */
@Service("applicationInfoService")
public class ApplicationServiceImpl implements ApplicationInfoService {

    @Value("${spring.application.name}")
    private String applicationName;

    @Value("${server.port}")
    private Integer port;

    @Override
    public ApplicationInfo getApplicationInfo() {
        ApplicationInfo applicationInfo = ApplicationInfo.getInstance();
        applicationInfo.setApplicationName(applicationName);
        applicationInfo.setPort(port);
        return applicationInfo;
    }
}